//
//  UIView+IBInspectable.swift
//  MPSinaWeibo
//
//  Created by DaVinci on 16/4/6.
//  Copyright © 2016年 DaVinci. All rights reserved.
//

import UIKit


extension UIView {


    @IBInspectable var cornerRadius: CGFloat{
    
        get{
        
           return layer.cornerRadius
        }
       
        set{
        
            layer.cornerRadius = newValue
            
            if newValue > 0 {
            
               layer.masksToBounds = true
            }else{
            
               layer.masksToBounds = false
            }
        }
    }
  
    
    @IBInspectable var borderWidth: CGFloat{
    
        get{
        
          return layer.borderWidth
        }
    
        set{
        
          layer.borderWidth = newValue
        }
    }
    
    
    @IBInspectable var borderColor: UIColor{
    
     
        get{
           
            let color = UIColor(CGColor: layer.borderColor!)
            return color
        }
        
        set{
        
          layer.borderColor = newValue.CGColor
        }
    }
}